package dnl.util.ui.tree;

/**
 * @author Daniel Or
 * @version 1.0
 */
public class TreeEvent {

  //~ Constructors =============================================================

  /**
   * Constructor for TreeEvent.
   *
   * @param target
   * @param id
   * @param arg
   */
  public TreeEvent(EventType type, TreeItem treeItem) {
    this.type = type;
    this.treeItem = treeItem;
  }

  //~ Methods ==================================================================

  /**
   *
   * @return 
   */
  @Override
public String toString() {
    return TreeEvent.class.getName() + " " + type.toString() + " on item " +
    treeItem;
  }

  //~ Classes ==================================================================

  public static final class EventType {
    private EventType(int val) {
      this.val = val;
    }

    @Override
	public String toString() {

      switch (val) {

      case 0:
        return "Selection Event";

      case 1:
        return "Expansion Event";

      case 2:
        return "Collapse Event";

      default:
        return "no such type";
      }
    }

    private int val;
  }

  //~ Instance variables =======================================================

  /**  */
  public final EventType type;

  /**  */
  public final TreeItem treeItem;

  //~ Static variables/initializers ============================================

  /**  */
  public static final EventType SELECTION = new EventType(0);

  /**  */
  public static final EventType EXPANSION = new EventType(1);

  /**  */
  public static final EventType COLLAPSE = new EventType(2);
}
